package controlLayer;

import java.util.List;
import java.util.ArrayList;

import dbLayer.DBSchedule;
import modelLayer.Schedule;
import modelLayer.Class;

public class ScheduleCtrl {
	
	private DBSchedule dbSchedule = new DBSchedule();
	private Schedule schedule;
	private int selectedBlockNo;
	
	public ScheduleCtrl () {
		
	}
	
	public void createBlankSlade (List<Class> classes) {
		
		dbSchedule.blankSlade(classes);
		
	}
	
	public List<Schedule> allScheduleBlocks () {
		
		List<Schedule> schedules = new ArrayList<>();
		schedules = dbSchedule.getAllSchedules();
		
		return schedules;
	}
	
	public Schedule editScheduleBlock (Schedule s) {
		
		this.schedule = s;
		
		return this.schedule;
		
	}
	
	public List<Schedule> classScheduleBlocks (int classID) {
		
		List<Schedule> schedules = new ArrayList<>();
		schedules = dbSchedule.findScheduleBlockID(classID);
		
		return schedules;
	}
	
	public List<Schedule> schedulesAtBlockNo (int blockNo) {
		
		List<Schedule> matchingSchedules = dbSchedule.tbAtBlockNo(blockNo);
		
		return matchingSchedules;
	}
	
	public void addTBToSchedule (int classID, int blockNo, int tbID) {
		
		dbSchedule.addTBToSchedule(classID, blockNo, tbID);
		
	}
	
	public void removeTBFromSchedule (int blockNo, int classID) {
		
		dbSchedule.removeTBFromSchedule(blockNo, classID);
		
	}
	
	public void setSchedule (Schedule s) {
		
		this.schedule = s;
		
	}

	public int getSelectedBlockNo() {
		return selectedBlockNo;
	}

	public void setSelectedBlockNo(int selectedBlockNo) {
		this.selectedBlockNo = selectedBlockNo;
	}
	
}
